package thread;

public class Demo7 {
    //查看进程时候还存活
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(()->{
            for(int i=0;i<3;i++){
                System.out.println("hello Thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        });

        System.out.println(thread.isAlive());//还没创建进程false

        thread.start();

        while(true) {
            System.out.println(thread.isAlive());//进程销毁，Thread还存在
            Thread.sleep(1000);
        }
    }
}
